name: lint PR
on:
  pull_request:
  push:
    branches:
      - main
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main'}}
jobs:
  linter:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    steps:
    - name: Git checkout
      uses: actions/checkout@v3
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: 3.11
    - name: Install poetry
      uses: abatilo/actions-poetry@v3
    - name: Install linters
      run: poetry install --no-root --only linters
    - name: Run black
      run: poetry run black --check .
    - name: Run Flake8
      run: poetry run flake8 .
    - name: Run mypy
      run: poetry run mypy .
    - name: Run isort
      run: poetry run isort --check .
